// pages/myorderbox/sendsuccess/sendsuccess.js
import {
  errorMsg
} from '../../../utils/tool.js'
Page({

  /**
   * 页面的初始数据
   */
  data: {
    dataInfo: null,
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {
    let dataInfo = JSON.parse(unescape(options.dataInfo))
    dataInfo.express_info && dataInfo.express_info.data.map((o, i) => {
      o.m = o.time.substr(5, 5);
      o.t = o.time.substr(11, 5);
    })
    this.setData({
      dataInfo: dataInfo
    })
  },
  /**
   * 用户点击右上角分享
   */
  // onShareAppMessage: function (res) {
  //   debugger;
  //   if (res.from === 'button') {
  //     // 来自页面内转发按钮
  //     console.log(res.target)
  //   }
  //   return {
  //     title: '查看订单物流',
  //     path: "pages/myorderbox/vieworderdetail/vieworderdetail?orderId=" + this.data.my_order_id
  //   }
  // },
  //复制
  onCopy: function(e) {
    let {
      ordernum
    } = e.currentTarget.dataset;
    wx.setClipboardData({
      data: ordernum,
      success() {
        errorMsg("复制成功")
      }
    })
  },
  //图片预览
  previewImage: function(e) {
    var current = e.currentTarget.dataset.src;
    wx.previewImage({
      current: current, // 当前显示图片的http链接		  	
      urls: [current] // 需要预览的图片http链接列表	
    })
  },
})